import { combineReducers } from "redux";
import {
    createReduxContainer,
    createReactNavigationReduxMiddleware,
    createNavigationReducer,
  } from 'react-navigation-redux-helpers';
// import AppContainer from './src/AppContainer'
import { TabNavigator, } from '../AppContainer';


const defaultState = {
    status: 'ok',
    cale: 0,
}
const sharedState = (state = defaultState, action) => {
    switch (action.type) {
        case 'PLUS': {
            return {
                ...state,
                cale: state.cale + action.number,
            }
        }
        case 'MINUS': {
            return {
                ...state,
                cale: state.cale - action.number,
            }
        }
        default: {
            return state;
        }
    }
}

const navReducer = createNavigationReducer(TabNavigator);

const appReducer = combineReducers({
    nav: navReducer,
    sharedState,
});

export default appReducer;